package com.tencreat.mall.controller.app;

import com.tencreat.common.core.HttpResult;
import com.tencreat.domain.mall.MallPoster;
import com.tencreat.domain.mall.dto.MallPosterDto;
import com.tencreat.service.mall.IMallPosterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("/api/poster")
@Api(tags = "98-推广海报")
@RestController
public class MallPosterController {

    @Resource
    private IMallPosterService mallPosterService;

    /**
     * 查询海报配置列表
     */
    @ApiOperation(value="查询海报配置列表")
    @PostMapping("/list")
    public HttpResult<List<MallPoster>> allList(MallPosterDto dto) {
        // 不传  默认海报配置
        if (dto.getType() == null){
            dto.setType(1);
        }

        return HttpResult.ok(mallPosterService.lambdaQuery().eq(MallPoster::getType,dto.getType()).list());
    }

}
